<template>
  <div>
    <button @click="add">+</button>
    <span>{{ num }}</span>
    <button @click="reduce">-</button>
  </div>
</template>
<script>
export default {
  props: ['num', 'max', 'min'],
  methods: {
    add () {
      if (this.num < this.max) {
        this.$emit('setNum', 1)
      }
    },
    reduce () {
      if (this.num > this.min) {
        this.$emit('setNum', -1)
      }
    }
  }
}
</script>
<style></style>
